<template>
<div>
	<x-dialog v-model="show" style="width:100%">
		<div class="weui-dialog__hd showContent">
			<strong class="weui-dialog__title">{{name}}</strong>
		</div>
		<div class="weui-dialog__bd">
			<divider>转交人</divider>
			<flexbox>
				<flexbox-item>
					<span v-if="user.length>0">{{user[0].name}}</span>
				</flexbox-item>
				<flexbox-item>
					<ab-cust-dialog :dialogSetting="{displayFields:[{showName:'姓名',columnName:'fullname'}],multiple:false}" dialogKey="userSelector" :model="user">自由选择</ab-cust-dialog>
				</flexbox-item>
			</flexbox>
			<divider>意见/备注</divider>
			<textarea style="width: 261px; height: 130px;" v-model="flowParam.opinion" class="weui-input"></textarea>
			<divider>消息类型</divider>
			<ab-checkbox v-model="flowParam.extendConf.msgType" >
		    	<div slot-scope="scope">
		            <label class=" checkbox-inline" v-for="item in msgList"><input type="checkbox" name="msgType" v-model="scope.tempData.currentValue" :value="item.type"/>{{item.title}}</label>
		        </div>
  			</ab-checkbox>
			<div style="text-align : left;" v-if="flowParam.extendConf.msgType">
				<divider>消息内容</divider>
				您有一条新的转办任务，请及时办理。 转办备注为：{{flowParam.opinion}}。<br/>
				流程标题为：${流程标题}
			</div>
		</div>
		<div class="weui-dialog__ft">
			<a class="weui-dialog__btn weui-dialog__btn_default" v-on:click="ok()">确定</a>
			<a class="weui-dialog__btn weui-dialog__btn_default" v-on:click="cancel()">取消</a>
		</div>
	</x-dialog>
</div>
</template>

<script>
import Vue from 'vue'
export default {
	props:['passConf','showDialog','name'],
  	data :function () {
    	return {
	    	flowParam:this.passConf,
	   		show:false,
	   		user : [],
	   		msgList : [],
	    }
   	},
   	methods: {
    	ok:function(){
	    	if(!this.flowParam.opinion){
	    		Vue.tools.toast("请完善意见！","warn");
	    		return ;
	    	}
	    	if(this.user.length==0){
	    		Vue.tools.toast("请选择人员！","warn");
	    		return ;
	    	}
	    	this.flowParam.nodeUsers = this.flowParam.nodeUsers || {};
	    	this.flowParam.nodeUsers[this.flowParam.nodeId] = [{
	    		id:this.user[0].id,
	    		name:this.user[0].name,
	    		type:"user"
	    	}];
	    	this.show = false;
	    	this.$emit('callback',this.flowParam);
	    },
		cancel:function(){
			this.show = false;
			this.$emit('cancel',this.flowParam);
		},
		
   },
   watch:{
	   	showDialog:function(value,oldValue){
		   	this.show = value;
	   	},
 	},
   	created :function(){
   		var that = this;
   		this.show = this.showDialog;
   		
   		var url = Vue.__ctx + "/sys/tools/getInterFaceImpls?classPath=com.dstz.sys.simplemq.handler.msg.AbsNotifyMessageHandler";
 	   	var post = Vue.baseService.post(url,this.flowParam);
 	 	this.$vux.loading.show({ text: 'Loading' });
	   	post.then(function(data){
	   		that.$vux.loading.hide();
	   		that.msgList = data;
	   	});
   	}
}


</script>
